import request from '@/utils/request'

export default class Attendances {
  // 获取考勤列表
  static getAttendancesList(params: any) {
    return request({
      url: '/attendances',
      params
    })
  }
  // 获取考勤详情
  static getAtteArchiveDetail(data: any) {
    return request({
      url: `/attendances/archive/${data.userId}/${data.yearMonth}`
    })
  }
  static updateAttendance(data: any) {
    return request({
      url: `/attendances/${data.userId}`,
      method: 'put',
      data
    })
  }
  static getArchivingList(params: any) {
    return request({
      url: '/attendances/reports/year',
      params
    })
  }
  static getArchivingCont(params: any) {
    return request({
      url: `/attendances/reports/${params.atteArchiveMonthlyId}`,
      params
    })
  }

  static importArchive(data: any) {
    return request({
      url: '/archive/atte/export',
      method: 'post',
      data
    })
  }
  // 提醒接口
  static notify() {
    return request({
      url: '/notify/mail',
      method: 'post'
    })
  }
  static archives(params: any) {
    return request({
      url: '/attendances/archives',
      params
    })
  }
  static newReports(params: any) {
    return request({
      url: '/attendances/newReports',
      params
    })
  }
  static information() {
    return request({})
  }

  static pay() {
    return request({})
  }
  static reportFormList(params: any) {
    return request({
      url: '/attendances/reports',
      params
    })
  }

  // 请假保存
  static leaveSave(data: any) {
    return request({
      url: '/cfg/leave',
      method: 'put',
      data
    })
  }
  // 请假获取
  static getLeave(data: any) {
    return request({
      url: '/cfg/leave/list',
      method: 'post',
      data
    })
  }
  // 扣款设置保存
  static deductionsSave(data: any) {
    return request({
      url: '/cfg/deduction',
      method: 'put',
      data
    })
  }
  // 获取扣款设置
  static getDeductions(data: any) {
    return request({
      url: '/cfg/ded/list',
      method: 'post',
      data
    })
  }

  // 加班配置保存
  static overtimeSave(data: any) {
    return request({
      url: '/cfg/extDuty',
      method: 'put',
      data
    })
  }

  // 获取加班配置
  static getOvertime(data: any) {
    return request({
      url: '/cfg/extDuty/item',
      method: 'post',
      data
    })
  }
  // 考勤数据保存
  static attendanceSave(data: any) {
    return request({
      url: '/cfg/atte',
      method: 'put',
      data
    })
  }
  // 考勤数据保存
  static getAttendance(data: any) {
    return request({
      url: '/cfg/atte/item',
      method: 'post',
      data
    })
  }
  static fileUpdate(data: any) {
    return request({
      url: `/employee/archives/${data.month}`,
      method: 'put',
      data
    })
  }
}
